// 连接MongoDB

// 引入mongoose
const mongoose = require('mongoose')

const url = 'mongodb://localhost:27017/foodweb'

// 连接
mongoose
    .connect(url, { useNewUrlParser: true, useUnifiedTopology: true }).then(() => {
        console.log('数据库连接成功')
    })
    .catch((error => {
        console.log('数据库连接失败')
        console.log(error)
    }))

// 暴露出去

module.exports = mongoose